const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{
			label: '随机值',
			prop: 'randomNo',
		},
		{
			label: '模板名称',
			prop: 'templateName',
		},
		{
			label: '模版类型',
			prop: 'templateType',
			propName:'templateTypeLabel',
			type: 'remoteSelect',
			api:'getDictItemList',
			code:'TEMPLATE_TYPE',
			multiple:false,
		},
		{
			label: '模版内容',
			prop: 'templateContent',
		},
		{
			label: '创建人姓名',
			prop: 'createUserName',
		},
		{
			label: '新增时间',
			prop: 'createTime',
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const formConfig = {
	label: '数据管理设置',
	prop: 'base0',
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '模版名称',
			prop: 'templateName',
			type: 'input',
			span: 8,
			rules: [{ required: true, message: '请填写模版名称' }],
		},
		{
			label: '模版内容',
			prop: 'templateContent',
			type: 'input',
			span: 8,
			rules: [{ required: true, message: '请填写模版内容' }],
		},
		{
			label: '模版类型',
			prop: 'templateType',
			propName:'templateTypeLabel',
			type: 'remoteSelect',
			api:'getDictItemList',
			code:'TEMPLATE_TYPE',
			multiple:false,
			span: 8,
			rules: [{ required: true, message: '请选择模版类型' }],
		}
	],
}
const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '随机值',
			prop: 'randomNo',
			type: 'input',
			span: 6,
		},
		{
			label: '模版名称',
			prop: 'templateName',
			type: 'input',
			span: 6,
		},
		{
			label: '模版内容',
			prop: 'templateContent',
			type: 'input',
			span: 6,
		},
		{
			label: '模版类型',
			prop: 'templateType',
			propName:'templateTypeLabel',
			type: 'remoteSelect',
			api:'getDictItemList',
			code:'TEMPLATE_TYPE',
			multiple:false,
		}
	],
}
export const baseConfig: any = {
	pageName: '信息模版',
	addLabel: '添加',
	dictcodes: ['TEMPLATE_TYPE'],
	rowKey: 'id',
	tipLabel: 'templateName',
	api: {
		index: 'view_dataNoteTemplate_page',
		add: 'view_dataNoteTemplate_add',
		edit: 'view_dataNoteTemplate_edit',
		delete: 'view_dataNoteTemplate_del',
	},
	auth: {
		index: 'view_dataNoteTemplate_page',
		add: 'view_dataNoteTemplate_add',
		edit: 'view_dataNoteTemplate_edit',
		delete: 'view_dataNoteTemplate_del',
	},
	menuBtn: [
		{
			icon: 'editor',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: 'view_dataNoteTemplate_edit',
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'primary',
			operate: 'delete',
			auth: 'view_dataNoteTemplate_del',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '80%',
	},
	searchConfig,
	tableConfig,
	formConfig,
	saveFormate: async (form) => {
		return new Promise((resolve, reject) => {
			if(!form.templateContent.includes('【${code}】')){
				form.templateContent = '【${code}】'+form.templateContent
			}
			resolve({
				...form,
			})
		})
	},
}
